# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=hunter
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=3.7.0
pkgrel=3
pkgdesc="Hunter is a flexible code tracing toolkit (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://python-hunter.readthedocs.io/'
msys2_repository_url='https://github.com/ionelmc/python-hunter'
msys2_references=(
  'purl: pkg:pypi/hunter'
)
license=('spdx:BSD-2-Clause')
depends=("${MINGW_PACKAGE_PREFIX}-python-colorama"
         "${MINGW_PACKAGE_PREFIX}-python-manhole")
optdepends=("${MINGW_PACKAGE_PREFIX}-gdb: for remote support")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-build"
             "${MINGW_PACKAGE_PREFIX}-python-installer"
             "${MINGW_PACKAGE_PREFIX}-python-setuptools"
             "${MINGW_PACKAGE_PREFIX}-python-setuptools-scm"
             "${MINGW_PACKAGE_PREFIX}-cython"
             "${MINGW_PACKAGE_PREFIX}-cc")
checkdepends=("${MINGW_PACKAGE_PREFIX}-python-pytest-benchmark"
              "${MINGW_PACKAGE_PREFIX}-python-pytest"
              #"${MINGW_PACKAGE_PREFIX}-python-process-tests"
              #"${MINGW_PACKAGE_PREFIX}-python-virtualenv"
             )
options=('!strip')
source=("https://pypi.org/packages/source/${_realname::1}/${_realname}/${_realname}-${pkgver}.tar.gz")
sha512sums=('3f4ac69206367813c6f56eb4329d4ebf3ce6e1f6c5e257a27121a3e0dfacc761ac69da18e6d12b614d4f3c8425835c69f8a5b0ec6764ce910287a0b9c62d90e0')

build() {
  export SETUPTOOLS_SCM_PRETEND_VERSION="${pkgver}"

  cp -r "${_realname}-${pkgver}" "python-build-${MSYSTEM}" && cd "python-build-${MSYSTEM}"
  python -m build --wheel --skip-dependency-check --no-isolation
}

package() {
  cd "python-build-${MSYSTEM}"

  MSYS2_ARG_CONV_EXCL="--prefix=" \
    python -m installer --prefix=${MINGW_PREFIX} \
    --destdir="${pkgdir}" dist/*.whl

  install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
}
